<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp" %>
<%
	String path = request.getContextPath();
	if (path.equals("/")) {
		path = "";
	}
	pageContext.setAttribute("path", path);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="${path}/favicon.ico" >
<link rel="stylesheet" type="text/css" href="${path}/css/manage_center.css"/> 
<script type="text/javascript" src="<%=path%>/js/jquery/jquery-1.5.1.js"></script>
<script type="text/javascript" src="${path}/js/jquery/jquery.corner.js"></script>
<script type="text/javascript" src="${path}/js/common.js"></script>
<title>报名人员管理</title>

<script type="text/javascript">

//删除公共部分
function delPublic(ids) {
	var url = "${path}/adminmgr/emp_deleteTrueEmployee?ids="+ids;
	$.get(url,null,function(data){
		if(data == 'success') {
			alert("删除成功");
			window.location.reload(true);			
		} else {
			alert("操作失败");
		}
	}, "text");
}

//批量删除
function delEmps() {
	var checkboxs = document.getElementsByName("boxIds");
	var falg = false;
	for ( var i = 0; i < checkboxs.length; i++) {
		if (checkboxs[i].checked) {
			falg = true;
		}
	}
	if (!falg) {
		alert("请选择数据!");
		return false;
	} else {
		if(confirm("确定删除吗?")){
			delId = "";
			for ( var i = 0; i < checkboxs.length; i++) {
				if (checkboxs[i].checked) {
					delId += checkboxs[i].value + "|";
				}
			}
			delPublic(delId);
		}
	}
}

//根据id删除
function delById(id) {
	if(id == null || id == "") {
		alert("请选择数据");
	} else {
		if(confirm("确定删除吗?")){
			delPublic(id);
		}
	}
	
}

jQuery(function() {
    //搜索框提示文字
    var defaultKeyWord = "支持手机模糊查询";
    $("#keyWord").focus(function() {
    	if ($(this).val()==defaultKeyWord) {
    		$(this).val("");
    		$(this).css("color", "#000");
    	}
    });
    $("#keyWord").blur(function() {
        if ($(this).val()=="") {
            $(this).val(defaultKeyWord);
            $(this).css("color", "#ccc");
        }
    });
    //搜索框默认值
    if ($("#keyWord").val() == "") {
    	$("#keyWord").val(defaultKeyWord);
    	$("#keyWord").css("color", "#ccc");
    }
    //提交前处理
    $("#search_form").submit(function() {
    	if ($("#keyWord").val()==defaultKeyWord) {
    		$("#keyWord").val("");
        }
    });
});
</script>

<style type="text/css">
	table .td_link a {
	    color: #0000FF;
	}
</style>
</head>

	<body>
	
		<div id="right0">
       <table class="all_table" border="0">
                <tr class="tops" style="background: #DCD9D3;">
                    <td>                    
                        <form name="forms" id="search_form" action="${path}/adminmgr/<s:property value='url'/>" method="post">
                        	<ul>	
		                        <li>
		                        	  &nbsp;手机查询：<input type="text" name="keyWord" maxlength="17" id="keyWord"  
		                        	  value='<s:property value="keyWord"/>' class="lineheight" style="width:250px;margin-top: 3px;margin-top: 2px \9;" />
			                    		<s:submit name="sub" cssClass="button_fy_deep" theme="simple"
			                                value="查询"></s:submit>  
		                        </li>
		                        <li>
		                        	<table style="margin-left: 500;"><tr><td>
		                        		<input type="button" value="选中删除" onclick="delEmps()"/>
		                        	</td></tr></table>
		                        </li>
	                        </ul>
			            </form>
			            
                    </td>
                </tr>
                <tr valign="top">
                    <td>  
                            <div class="content2" style="margin-top: 0px;">
					            <table id="tablea" class="tablea" style="margin-left: 5px;">
					                <tbody>
					                    <tr class="tr3">
					                        <th width="25"><input type="checkbox" name="checkbox"
					                            onclick="changeAll(this.checked)" />
					                        </th>
					                        <th>名称</th>
					                        <th>手机</th>
					                        <th>性别</th> 
											<th>报名时间</th>					                                            
					                        <th>更新时间</th>                     
					                        <th>分配状态</th>                       
					                        <th>操作着</th>                      
					                        <th width="140">其他操作</th>
					                    </tr>
					                    <s:iterator value="pageModel.list" status="stat">
					                        <tr class="tr<s:property value='#stat.index%2+1' />" >
					                            <td style="line-height: 33px;height:33px;"><input type="checkbox" name="boxIds"
					                                value="<s:property value="id" />" />
					                            </td>
					                            <td><s:property value="name" /></td>
					                            <td><s:property value="mobile" /></td>
					                            <td><s:if test="sex == 1">男</s:if><s:elseif test="sex == 0">女</s:elseif></td>
					                            <td><s:date name="createTime" format="yyyy-MM-dd HH:mm:ss"/></td>
					                            <td><s:date name="updateTime" format="yyyy-MM-dd HH:mm:ss"/></td>
					                            <td><s:if test="assign == \"n\""><font color="red">未分配</font></s:if><s:elseif test="assign == \"y\"">已分配</s:elseif>
					                            </td>
					                            <td><s:property value="operator.name" /></td>
					                            
					                           
					                            <td width="140" class="td_link">
					                            	<a href="javascript::" onclick="delById('<s:property value="id" />')">彻底删除</a>
					                            </td>
					                        </tr>
					                    </s:iterator>
					                </tbody>
					            </table>
					        </div>
					        <div class="foot">
					        		<div class="info">共<s:property value="pageModel.total"/>条数据&nbsp;&nbsp;&nbsp;每页显示10条数据&nbsp;&nbsp;&nbsp;
									<pg:pager url="${url }" items="${pageModel.total }" export="currentPageNumber=pageNumber" maxPageItems="10" isOffset="true">
										<pg:param name="keyWord"/>
										<pg:first>
												<a href="${pageUrl}">首页</a>
										</pg:first>
										<pg:prev>
											<a href="${pageUrl }">上一页</a>
										</pg:prev>
										<pg:pages>
											<c:choose>
												<c:when test="${currentPageNumber eq pageNumber }">
													${pageNumber }
												</c:when>
												<c:otherwise>
													<a href="${pageUrl }">${pageNumber }</a>
												</c:otherwise>
											</c:choose>
										</pg:pages>
										<pg:next>
											<a href="${pageUrl }">下一页</a>
										</pg:next>
										<pg:last>
											<a href="${pageUrl }">尾页</a>
										</pg:last>
								</pg:pager>
								</div>
							</div>
                    </td>
                </tr>
                <tr>
                </tr>
            </table>
		<div class="clear"></div>
	</div>
	
		<script type="text/javascript">
	       //变成圆角 
		   becomeCorner('all_table');
	   </script>
	</body>
</html>
